home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / text / faqs / x-faq.part5 < prev    next >
Encoding:
Text File  |  1994-05-23  |  47.6 KB  |  1,018 lines

  1. Newsgroups: comp.windows.x,news.answers,comp.answers
  2. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!spool.mu.edu!sgiblab!swrinde!cs.utexas.edu!uunet!visual!dbl
  3. From: dbl@visual.com (David B. Lewis)
  4. Subject: comp.windows.x Frequently Asked Questions (FAQ) 5/5
  5. Message-ID: <CIE3FL.4A8@visual.com>
  6. Followup-To: poster
  7. Summary: useful information about the X Window System
  8. Reply-To: faq%craft@uunet.uu.net (X FAQ maintenance address)
  9. Organization: VISUAL, Inc.
  10. Date: Tue, 21 Dec 1993 14:40:33 GMT
  11. Approved: news-answers-request@MIT.Edu
  12. Expires: Sun, 23 Jan 1994 00:00:00 GMT
  13. Lines: 1002
  14. Xref: senator-bedfellow.mit.edu comp.windows.x:77387 news.answers:16065 comp.answers:3115
  15.  
  16. Archive-name: x-faq/part5
  17. Last-modified: 1993/12/20
  18.  
  19. ----------------------------------------------------------------------
  20. Subject: 123)  Why does XtGetValues not work for me (sic)?
  21.  
  22.     The XtGetValues interface for retrieving resources from a widget is
  23. sensitive to the type of variable. Your code may be doing something like this:
  24.     {
  25.     Arg args[3];
  26.     int i;
  27.     int sensitive;        /* oops; wrong data type */
  28.     i=0;
  29.     XtSetArg (args[i], XtNsensitive, &sensitive); i++;
  30.     XtGetValues(widget, args, i );
  31.     ...
  32.     }
  33.  
  34. But XtNsensitive is a Boolean, which on most machines is a single byte; 
  35. declaring the variable "sensitive" as Boolean works properly. This problem 
  36. comes up often when using particular toolkits that redefine the Xt types 
  37. Dimension and Position; code that assumes they are int will have similar 
  38. problems if those types are actually short. In general: you are safe if you
  39. use the actual type of the resource, as it appears in the widget's man page.
  40. [11/90]
  41.  
  42. ----------------------------------------------------------------------
  43. Subject: 124)  Why don't XtConfigureWidget/XtResizeWidget/XtMoveWidget work?
  44.  
  45.     You're probably trying to use these functions from application code.
  46. They should be used only internally to widgets; these functions are for a 
  47. parent widget to change the geometry of its children. Other promising 
  48. functions, XtMakeGeometryRequest() and XtMakeResizeRequest(), are also for use 
  49. only by widgets, in this case by a child to request a change from its parent.
  50.     The only way for your application to request a geometry change for a
  51. widget is to issue an XtSetValues call setting some of the geometry resources.
  52. Although this will result in the widget-internal functions' being called, your
  53. application code must use the standard XtSetValues interface or risk the 
  54. widgets' data becoming corrupted.
  55.     [The Xlib calls XMoveWindow() and XResizeWindow() should similarly be 
  56. avoided; they shouldn't be used to change XtNx, XtNy, XtNwidth, or XtNheight.]
  57.  
  58. ----------------------------------------------------------------------
  59. Subject: 125)  Why isn't there an XtReparentWidget call like XReparentWindow?
  60.  
  61.     Although there are various details of the current implementation of
  62. the Xt internals which make reparenting difficult, the major reason that no
  63. such call exists is that it remains undefined what the set of resources for
  64. the "new" widget should be. Resources are typically set based on the location
  65. in the instance hierarchy; what resources should change if the instance moves?
  66. What should happen to the widget's children? And by the time such semantics are
  67. defined, there would probably be little advantage over destroying the old 
  68. widget and creating a new widget in the correct location with the desired 
  69. resources, as setting the resources correctly is the majority of work in 
  70. creating a new widget.
  71.  
  72.     Note that reparenting is possible in the OI toolkit.
  73.  
  74. ----------------------------------------------------------------------
  75. Subject: 126)  I'm writing a widget and can't use a float as a resource value.
  76.  
  77. Float resources are not portable; the size of the value may be larger than
  78. the size of an XtPointer. Try using a pointer to a float instead; the Xaw
  79. Scrollbar float resources are handled in this way. 
  80.  
  81. ----------------------------------------------------------------------
  82. Subject: 127)  Is this a memory leak in the X11R4 XtDestroyWidget()?!
  83.  
  84. Yes. This is the "unofficial" fix-19 for the X11R4 Destroy.c:
  85.  
  86. *** Destroy.c.1.37    Thu Jul 11 15:41:25 1991
  87. --- lib/Xt/Destroy.c    Thu Jul 11 15:42:23 1991
  88. ***************
  89. *** 1,4 ****
  90. --- 1,5 ----
  91.   /* $XConsortium: Destroy.c,v 1.37 90/09/28 10:21:32 swick Exp $ */
  92. + /* Plus unofficial patches in revisions 1.40 and 1.41 */
  93.   
  94.   /***********************************************************
  95.   Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  96. ***************
  97. *** 221,239 ****
  98.        */
  99.   
  100.       int i = 0;
  101. !     DestroyRec* dr = app->destroy_list;
  102.       while (i < app->destroy_count) {
  103.       if (dr->dispatch_level >= dispatch_level)  {
  104.           Widget w = dr->widget;
  105.           if (--app->destroy_count)
  106.           bcopy( (char*)(dr+1), (char*)dr,
  107. !                app->destroy_count*sizeof(DestroyRec)
  108.                 );
  109.           XtPhase2Destroy(w);
  110.       }
  111.       else {
  112.           i++;
  113. -         dr++;
  114.       }
  115.       }
  116.   }
  117. --- 222,245 ----
  118.        */
  119.   
  120.       int i = 0;
  121. !     DestroyRec* dr;
  122.       while (i < app->destroy_count) {
  123. +     /* XtPhase2Destroy can result in calls to XtDestroyWidget,
  124. +      * and these could cause app->destroy_list to be reallocated.
  125. +      */
  126. +     dr = app->destroy_list + i;
  127.       if (dr->dispatch_level >= dispatch_level)  {
  128.           Widget w = dr->widget;
  129.           if (--app->destroy_count)
  130.           bcopy( (char*)(dr+1), (char*)dr,
  131. !                (app->destroy_count - i) * sizeof(DestroyRec)
  132.                 );
  133.           XtPhase2Destroy(w);
  134.       }
  135.       else {
  136.           i++;
  137.       }
  138.       }
  139.   }
  140.  
  141. [from Donna Converse, converse@x.org]
  142.  
  143. ----------------------------------------------------------------------
  144. Subject: 128)  Is this a memory leak in the X11R4 deletion of work procs?!
  145.  
  146. Apparently the X11R4 NextEvent.c`CallWorkProc fails to properly replace
  147. the work proc record back on the free list correctly.
  148.  
  149.         if (delete) {
  150.             w->next = freeWorkRecs;
  151.             freeWorkRecs = w->next;    /* should be  =w; */
  152.         }
  153.  
  154. ----------------------------------------------------------------------
  155. Subject: 129)  Why does the process size of my X programs go up,up,up?
  156.  
  157. Using "ps" may not show any decrease in memory size after a malloc/free pair. 
  158. With most vendors' implementations of memory managers, the call to free does 
  159. not return memory to the operating system; it is probably maintained on a free 
  160. list for the process. In addition, ps may not be an accurate report of current
  161. memory usage requirements.
  162.  
  163. ----------------------------------------------------------------------
  164. Subject: 130)  Are callbacks guaranteed to be called in the order registered?
  165.  
  166.     Although some books demonstrate that the current implementation of Xt
  167. happens to call callback procedures in the order in which they are registered, 
  168. the specification does not guarantee such a sequence, and supplemental 
  169. authoritative documents (i.e. the Asente/Swick volume) do say that the order is
  170. undefined.  Because the callback list can be manipulated by both the widget and
  171. the application, Xt cannot guarantee the order of execution.
  172.     In general, the callback procedures should be thought of as operating 
  173. independently of one another and should not depend on side-effects of other
  174. callbacks operating; if a seqence is needed, then the single callback to be 
  175. registered can explicitly call other functions necessary.
  176.  
  177. [4/92; thanks to converse@x.org]
  178.  
  179. ----------------------------------------------------------------------
  180. Subject: 131)  Why doesn't XtDestroyWidget() actually destroy the widget?
  181.  
  182.     XtDestroyWidget() operates in two passes, in order to avoid leaving
  183. dangling data structures; the function-call marks the widget, which is not 
  184. actually destroyed until your program returns to its event-loop. 
  185.  
  186. ----------------------------------------------------------------------
  187. Subject: 132)  How do I query the user synchronously using Xt?
  188.     
  189.     It is possible to have code which looks like this trivial callback,
  190. which has a clear flow of control. The calls to AskUser() block until answer
  191. is set to one of the valid values. If it is not a "yes" answer, the code drops
  192. out of the callback and back to an event-processing loop: 
  193.  
  194.     void quit(Widget w, XtPointer client, XtPointer call)
  195.     {
  196.         int             answer;
  197.         answer = AskUser(w, "Really Quit?");
  198.         if (RET_YES == answer)
  199.             {
  200.             answer = AskUser(w, "Are You Really Positive?");
  201.             if (RET_YES == answer)
  202.                 exit(0);
  203.                 }
  204.     }
  205.  
  206.     A more realistic example might ask whether to create a file or whether 
  207. to overwrite it.
  208.     This is accomplished by entering a second event-processing loop and
  209. waiting until the user answers the question; the answer is returned to the
  210. calling function. That function AskUser() looks something like this, where the 
  211. Motif can be replaced with widget-set-specific code to create some sort of 
  212. dialog-box displaying the question string and buttons for "OK", "Cancel" and 
  213. "Help" or equivalents:
  214.  
  215.   int AskUser(w, string)
  216.         Widget          w;
  217.         char           *string;
  218.   {
  219.         int             answer=RET_NONE;    /* some not-used marker */
  220.         Widget          dialog;            /* could cache&carry, but ...*/
  221.         Arg             args[3];
  222.         int             n = 0;
  223.         XtAppContext    context;
  224.  
  225.         n=0;
  226.         XtSetArg(args[n], XmNmessageString, XmStringCreateLtoR(string,
  227.                 XmSTRING_DEFAULT_CHARSET)); n++;
  228.         XtSetArg(args[n], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL); n++;
  229.         dialog = XmCreateQuestionDialog(XtParent(w), string, args, n);
  230.         XtAddCallback(dialog, XmNokCallback, response, &answer);
  231.         XtAddCallback(dialog, XmNcancelCallback, response, &answer);
  232.         XtAddCallback(dialog, XmNhelpCallback, response, &answer);
  233.         XtManageChild(dialog);
  234.  
  235.         context = XtWidgetToApplicationContext (w);
  236.         while (answer == RET_NONE || XtAppPending(context)) {
  237.                 XtAppProcessEvent (context, XtIMAll);
  238.         }
  239.         XtDestroyWidget(dialog);  /* blow away the dialog box and shell */
  240.         return answer;
  241.   }
  242.  
  243.     The dialog supports three buttons, which are set to call the same 
  244. function when tickled by the user.  The variable answer is set when the user 
  245. finally selects one of those choices:
  246.  
  247.   void response(w, client, call)
  248.         Widget          w;
  249.         XtPointer client;
  250.         XtPointer call;
  251.   {
  252.   int *answer = (int *) client;
  253.   XmAnyCallbackStruct *reason = (XmAnyCallbackStruct *) call;
  254.         switch (reason->reason) {
  255.         case XmCR_OK:
  256.                 *answer = RET_YES;    /* some #define value */
  257.                 break;
  258.         case XmCR_CANCEL:
  259.                 *answer = RET_NO; 
  260.         break;
  261.         case XmCR_HELP:
  262.                 *answer = RET_HELP;
  263.                 break;
  264.         default:
  265.                 return;
  266.         }
  267. }
  268.  
  269. and the code unwraps back to the point at which an answer was needed and
  270. continues from there.
  271.  
  272. [Thanks to Dan Heller (argv@sun.com); note that the code in his book caches
  273. the dialog but neglects to make sure that the callbacks point to the
  274. current automatic "answer".]
  275.  
  276. ----------------------------------------------------------------------
  277. Subject: 133)  How do I determine the name of an existing widget?
  278. I have a widget ID and need to know what the name of that widget is.
  279.  
  280.     Users of R4 and later are best off using the XtName() function, which 
  281. will work on both widgets and non-widget objects.
  282.  
  283.     If you are still using R3, you can use this simple bit of code to do 
  284. what you want. Note that it depends on the widget's internal data structures 
  285. and is not necessarily portable to future versions of Xt, including R4.
  286.  
  287.     #include <X11/CoreP.h>
  288.     #include <X11/Xresource.h>
  289.     String XtName (widget)
  290.     Widget widget;    /* WILL work with non-widget objects */
  291.     {
  292.     return XrmNameToString(widget->core.xrm_name);
  293.     }
  294.  
  295. [7/90; modified with suggestion by Larry Rogers (larry@boris.webo.dg.com) 9/91]
  296.  
  297. ----------------------------------------------------------------------
  298. Subject: 134)  Why do I get a BadDrawable error drawing to XtWindow(widget)?
  299. I'm doing this in order to get a window into which I can do Xlib graphics
  300. within my Xt-based program:
  301.  
  302. > canvas = XtCreateManagedWidget ( ...,widgetClass,...) /* drawing area */
  303. > ...
  304. > window = XtWindow(canvas);    /* get the window associated with the widget */
  305. > ...
  306. > XDrawLine (...,window,...);    /* produces error */
  307.  
  308.     The window associated with the widget is created as a part of the 
  309. realization of the widget.  Using a window id of None ("no window") could 
  310. create the error that you describe.  It is necessary to call XtRealizeWidget() 
  311. before attempting to use the window associated with a widget. 
  312.     Note that the window will be created after the XtRealizeWidget() call, 
  313. but that the server may not have actually mapped it yet, so you should also 
  314. wait for an Expose event on the window before drawing into it.
  315.  
  316. ----------------------------------------------------------------------
  317. Subject: 135)  Where can I get documentation on Xaw, the Athena widget set?
  318.  
  319.     Check ftp.x.org in /pub/R5untarred/mit/hardcopy for the originals
  320. of documentation distributed with X11R5.
  321.  
  322. ----------------------------------------------------------------------
  323. Subject: 136)  What's the difference between actions and callbacks?
  324.  
  325. Actions and callbacks may be closely tied; the user may click a mouse-button
  326. in an object's window, causing an action procedure in that particular object
  327. to be called. As part of its processing of the event, the action procedure
  328. may inform the application via a callback registered on the object. However,
  329. callbacks can be given for any reason, including some that don't arise as a
  330. result of user action; and many actions don't result in any notification to
  331. the application.
  332.  
  333. Callbacks generally are a means of interaction between the user interface
  334. (UI) and some other piece of code interested in the "results"; the interested
  335. party to which the data is communicated is usually the application's back-end
  336. functions but may be another widget in a related part of the UI.  For
  337. example, a text widget invokes a callback to say "the user just entered this
  338. text string; never mind what I had to do to get it or what X events took
  339. place."
  340.  
  341. In object-oriented programming terminology, callback lists are messages
  342. defined by the widget class by which the widget istance notifies another
  343. entity that something significant has happened to the widget.
  344.  
  345. Actions, however, constitute a widget's repertoire of internal i/o
  346. behaviors.  Actions are not about results; actions are about "how", not
  347. "what" gets done. The text widget may define a dozen or two actions which
  348. define how the user can manipulate the text; the procedures for removing a
  349. line of text or switching two words can be associated with particular X event
  350. sequences (and in fact often rely on particular types of events).
  351.  
  352. Actions are (in OOP terminology) methods of the widget class by which the
  353. widget responds to some external stimulus (one or more X events).
  354.  
  355. To avoid confusing yourself on the issue of actions vs. callbacks, try
  356. thinking of actions defined by an application as methods *of the application*
  357. -- applications may define actions, as well -- by which the application
  358. responds to one or more X events (and happens to be handed an object handle
  359. as part of the method argument list). Similarly, callback handlers registered
  360. by an application with a widget can be thought of as methods of the
  361. application which respond to messages from a widget or widgets.
  362.  
  363. [Thanks to Michael Johnson (michael@maine.maine.edu) and to Kerry Kimbrough]
  364.  
  365. ----------------------------------------------------------------------
  366. Subject: 137)  How do I simulate a button press/release event for a widget?
  367.  
  368.     You can do this using XSendEvent(); it's likely that you're not setting
  369. the window field in the event, which Xt needs in order to match to the widget
  370. which should receive the event.
  371.      If you're sending events to your own application, then you can use 
  372. XtDispatchEvent() instead. This is more efficient than XSendEvent() in that you
  373. avoid a round-trip to the server.
  374.     Depending on how well the widget was written, you may be able to call
  375. its action procedures in order to get the effects you want.
  376.  
  377. [courtesy Mark A. Horstman (mh2620@sarek.sbc.com), 11/90]
  378.  
  379. ----------------------------------------------------------------------
  380. Subject: 138)  Can I make Xt or Xlib calls from a signal handler?
  381.  
  382.     No. Xlib and Xt have no mutual exclusion for protecting critical 
  383. sections. If your signal handler makes such a call at the wrong time (which 
  384. might be while the function you are calling is already executing), it can leave
  385. the library in an inconsistent state. Note that the ANSI C standard points
  386. out that behavior of a signal handler is undefined if the signal handler calls
  387. any function other than signal() itself, so this is not a problem specific to
  388. Xlib and Xt; the POSIX specification mentions other functions which may be
  389. called safely but it may not be assumed that these functions are called by 
  390. Xlib or Xt functions.
  391.     You can work around the problem by setting a flag in the interrupt
  392. handler and later checking it with a work procedure or a timer event which
  393. has previously been added.
  394.     R6 Xt will have support for signal handlers; there will be a
  395. mechanism to set a flag in a signal handler and XtAppNextEvent will notice
  396. that the flag has been set, and call the associated callbacks.
  397.  
  398.     Note: the article in The X Journal 1:4 and the example in O'Reilly 
  399. Volume 6 are in error.
  400.  
  401. [Thanks to Pete Ware (ware@cis.ohio-state.edu) and Donna Converse 
  402. (converse@x.org), 5/92]
  403.  
  404. An alternate solution is to create a pipe and add the read side of the pipe
  405. as an input event with XtAppAddInput; then write a byte to the write side of
  406. the pipe with your signal handler (write is re-entrant). The callback for the
  407. read side of the pipe reads the byte and does the actual processing that you
  408. intended. You may want the byte to be the signal number unless your callback
  409. handles only one kind.
  410.  
  411. [Thanks to Steve Kappel (stevek@apertus.com)]
  412.  
  413. ----------------------------------------------------------------------
  414. Subject: 139)  What are these "Xlib sequence lost" errors?
  415.  
  416.     You may see these errors if you issue Xlib requests from an Xlib error 
  417. handler, or, more likely, if you make calls which generate X requests to Xt or 
  418. Xlib from a signal handler, which you shouldn't be doing in any case. 
  419.  
  420. ----------------------------------------------------------------------
  421. Subject: 140)! How can my Xt program handle socket, pipe, or file input?
  422.  
  423.     It's very common to need to write an Xt program that can accept input 
  424. both from a user via the X connection and from some other file descriptor, but 
  425. which operates efficiently and without blocking on either the X connection or 
  426. the other file descriptor.
  427.     A solution is use XtAppAddInput(). After you open your file descriptor,
  428. use XtAppAddInput() to register an input handler. The input handler will be 
  429. called every time there is something on the file descriptor requiring your 
  430. program's attention. Write the input handler like you would any other Xt 
  431. callback, so it does its work quickly and returns.  It is important to use only
  432. non-blocking I/O system calls in your input handlers.
  433.     Most input handlers read the file descriptor, although you can have an 
  434. input handler write or handle exception conditions if you wish.
  435.     Be careful when you register an input handler to read from a disk file.
  436. You will find that the function is called even when there isn't input pending.
  437. XtAppAddInput() is actually working as it is supposed to. The input handler is 
  438. called whenever the file descriptor is READY to be read, not only when there is
  439. new data to be read. A disk file (unlike a pipe or socket) is almost always 
  440. ready to be read, however, if only because you can spin back to the beginning
  441. and read data you've read before.  The result is that your function will almost
  442. always be called every time around XtAppMainLoop(). There is a way to get the 
  443. type of interaction you are expecting; add this line to the beginning of your 
  444. function to test whether there is new data:
  445.          if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) return;
  446. But, because this is called frequently, your application is effectively in a 
  447. busy-wait; you may be better off not using XtAppAddInput() and instead setting 
  448. a timer and in the timer procedure checking the file for input.
  449.  
  450. [courtesy Dan Heller (argv@ora.com), 8/90; mouse@larry.mcrcim.mcgill.edu 5/91;
  451. Ollie Jones (oj@pictel.com) 6/92]
  452.  
  453. There are two alternatives: the simple one is to use XtAppAddTimeout instead
  454. of XtAppAddInput and check for input occasionally; the more complex solution,
  455. and perhaps the better one, is to popen or fork&exec a child which does
  456. blocking reads on the file, relaying what it has read to your application via
  457. a pipe or a socket. XtAppAddInput will work as expected on pipes and
  458. sockets.
  459.  
  460. [Thanks to Kaleb Keithley (kaleb@x.org); 12/93]
  461.  
  462. ----------------------------------------------------------------------
  463. Subject: 141)  Why do I get a BadMatch error when calling XGetImage?
  464.  
  465. The BadMatch error can occur if the specified rectangle goes off the edge of 
  466. the screen. If you don't want to catch the error and deal with it, you can take
  467. the following steps to avoid the error:
  468.  
  469. 1) Make a pixmap the same size as the rectangle you want to capture.
  470. 2) Clear the pixmap to background using XFillRectangle.
  471. 3) Use XCopyArea to copy the window to the pixmap.
  472. 4) If you get a NoExpose event, the copy was clean. Use XGetImage to grab the
  473. image from the pixmap.
  474. 5) If you get one or more GraphicsExpose events, the copy wasn't clean, and 
  475. the x/y/width/height members of the GraphicsExpose event structures tell you 
  476. the parts of the pixmap which aren't good.
  477. 6) Get rid of the pixmap; it probably takes a lot of memory.
  478.  
  479. [10/92; thanks to Oliver Jones (oj@pictel.com)]
  480.  
  481. ----------------------------------------------------------------------
  482. Subject: 142)  How can my application tell if it is being run under X?
  483.  
  484.     A number of programs offer X modes but otherwise run in a straight
  485. character-only mode. The easiest way for an application to determine that it is
  486. running on an X display is to attempt to open a connection to the X server:
  487.     
  488.     display = XOpenDisplay(display_name);
  489.     if (display)
  490.         { do X stuff }
  491.     else
  492.         { do curses or something else }
  493. where display_name is either the string specified on the command-line following
  494. -display, by convention, or otherwise is (char*)NULL [in which case 
  495. XOpenDisplay uses the value of $DISPLAY, if set].
  496.  
  497. This is superior to simply checking for the existence a -display command-line 
  498. argument or checking for $DISPLAY set in the environment, neither of which is 
  499. adequate. [5/91]
  500.  
  501. ----------------------------------------------------------------------
  502. Subject: 143)  How do I make a "busy cursor" while my application is computing?
  503. Is it necessary to call XDefineCursor() for every window in my application?
  504.  
  505.     The easiest thing to do is to create a single InputOnly window that
  506. is as large as the largest possible screen; make it a child of your toplevel
  507. window (which must be realized) and it will be clipped to that window, so it
  508. won't affect any other application. (It needs to be as big as the largest
  509. possible screen in case the user enlarges the window while it is busy or
  510. moves elsewhere within a virtual desktop.) Substitute "toplevel" with your
  511. top-most widget here (similar code should work for Xlib-only applications;
  512. just use your top Window):
  513.  
  514.      unsigned long valuemask;
  515.      XSetWindowAttributes attributes;
  516.  
  517.      /* Ignore device events while the busy cursor is displayed. */
  518.      valuemask = CWDontPropagate | CWCursor;
  519.      attributes.do_not_propagate_mask =  (KeyPressMask | KeyReleaseMask |
  520.          ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
  521.      attributes.cursor = XCreateFontCursor(XtDisplay(toplevel), XC_watch);
  522.  
  523.      /* The window will be as big as the display screen, and clipped by
  524.         its own parent window, so we never have to worry about resizing */
  525.      XCreateWindow(XtDisplay(toplevel), XtWindow(toplevel), 0, 0,
  526.          65535, 65535, (unsigned int) 0, 0, InputOnly,
  527.          CopyFromParent, valuemask, &attributes);
  528.  
  529. where the maximum size above could be replaced by the real size of the screen,
  530. particularly to avoid servers which have problems with windows larger than
  531. 32767.
  532.  
  533. When you want to use this busy cursor, map and raise this window; to go back to
  534. normal, unmap it. This will automatically keep you from getting extra mouse
  535. events; depending on precisely how the window manager works, it may or may not
  536. have a similar effect on keystrokes as well.
  537.  
  538. In addition, note also that most of the Xaw widgets support an XtNcursor 
  539. resource which can be temporarily reset, should you merely wish to change the
  540. cursor without blocking pointer events.
  541.  
  542. [thanks to Andrew Wason (aw@cellar.bae.bellcore.com), Dan Heller 
  543. (argv@sun.com), and mouse@larry.mcrcim.mcgill.edu; 11/90,5/91]
  544.  
  545. ----------------------------------------------------------------------
  546. Subject: 144)  How do I fork without hanging my parent X program?
  547.  
  548.     An X-based application which spawns off other Unix processes which 
  549. continue to run after it is closed typically does not vanish until all of its 
  550. children are terminated; the children inherit from the parent the open X 
  551. connection to the display. 
  552.     What you need to do is fork; then, immediately, in the child process, 
  553.         close (ConnectionNumber(XtDisplay(widget)));
  554. to close the file-descriptor in the display information. After this do your 
  555. exec. You will then be able to exit the parent.
  556.     Alternatively, before exec'ing make this call, which causes the file 
  557. descriptor to be closed on exec.
  558.         (void) fcntl(ConnectionNumber(XDisplay), F_SETFD, 1);
  559.  
  560. [Thanks to Janet Anstett (anstettj@tramp.Colorado.EDU), Gordon Freedman 
  561. (gjf00@duts.ccc.amdahl.com); 2/91. Greg Holmberg (holmberg@frame.com), 3/93.]
  562.  
  563. ----------------------------------------------------------------------
  564. Subject: 145)  Why doesn't anything appear when I run this simple program?
  565.  
  566. > ...
  567. > the_window = XCreateSimpleWindow(the_display,
  568. >      root_window,size_hints.x,size_hints.y,
  569. >      size_hints.width,size_hints.height,BORDER_WIDTH,
  570. >      BlackPixel(the_display,the_screen),
  571. >      WhitePixel(the_display,the_screen));
  572. > ...
  573. > XSelectInput(the_display,the_window,ExposureMask|ButtonPressMask|
  574. >     ButtonReleaseMask);
  575. > XMapWindow(the_display,the_window);
  576. > ...
  577. > XDrawLine(the_display,the_window,the_GC,5,5,100,100);
  578. > ...
  579.  
  580.     You are right to map the window before drawing into it. However, the 
  581. window is not ready to be drawn into until it actually appears on the screen --
  582. until your application receives an Expose event. Drawing done before that will 
  583. generally not appear. You'll see code like this in many programs; this code 
  584. would appear after window was created and mapped:
  585.   while (!done)
  586.     {
  587.       XNextEvent(the_display,&the_event);
  588.       switch (the_event.type) {
  589.     case Expose:     /* On expose events, redraw */
  590.         XDrawLine(the_display,the_window,the_GC,5,5,100,100);
  591.         break;
  592.     ...
  593.     }
  594.     }
  595.  
  596.     Note that there is a second problem: some Xlib implementations don't 
  597. set up the default graphics context to have correct foreground/background 
  598. colors, so this program could previously include this code:
  599.   ...
  600.   the_GC_values.foreground=BlackPixel(the_display,the_screen);    /* e.g. */
  601.   the_GC_values.background=WhitePixel(the_display,the_screen);    /* e.g. */
  602.   the_GC = XCreateGC(the_display,the_window,
  603.                 GCForeground|GCBackground,&the_GC_values);
  604.   ...
  605.  
  606. Note: the code uses BlackPixel and WhitePixel to avoid assuming that 1 is 
  607. black and 0 is white or vice-versa.  The relationship between pixels 0 and 1 
  608. and the colors black and white is implementation-dependent.  They may be 
  609. reversed, or they may not even correspond to black and white at all.
  610.  
  611. Also note that actually using BlackPixel and WhitePixel is usually the wrong 
  612. thing to do in a finished program, as it ignores the user's preference for 
  613. foreground and background.
  614.  
  615. And also note that you can run into the same situation in an Xt-based program
  616. if you draw into the XtWindow(w) right after it has been realized; it may
  617. not yet have appeared.
  618.  
  619. ----------------------------------------------------------------------
  620. Subject: 146)  What is the difference between a Screen and a screen?
  621.  
  622.     The 'Screen' is an Xlib structure which includes the information about
  623. one of the monitors or virtual monitors which a single X display supports. A 
  624. server can support several independent screens. They are numbered unix:0.0,
  625. unix:0.1, unix:0.2, etc; the 'screen' or 'screen_number' is the second digit --
  626. the 0, 1, 2 which can be thought of as an index into the array of available 
  627. Screens on this particular Display connection.
  628.     The macros which you can use to obtain information about the particular
  629. Screen on which your application is running typically have two forms -- one
  630. which takes a Screen and one with takes both the Display and the screen_number.
  631.     In Xt-based programs, you typically use XtScreen(widget) to determine 
  632. the Screen on which your application is running, if it uses a single screen.
  633.     (Part of the confusion may arise from the fact that some of the macros
  634. which return characteristics of the Screen have "Display" in the names -- 
  635. XDisplayWidth, XDisplayHeight, etc.)
  636.     
  637. ----------------------------------------------------------------------
  638. Subject: 147)  Can XGetWindowAttributes get a window's background pixel/pixmap?
  639.  
  640.     No.  Once set, the background pixel or pixmap of a window cannot be 
  641. re-read by clients.  The reason for this is that a client can create a pixmap,
  642. set it to be the background pixmap of a window, and then free the pixmap. The 
  643. window keeps this background, but the pixmap itself is destroyed.  If you're 
  644. sure a window has a background pixel (not a pixmap), you can use XClearArea() 
  645. to clear a region to the background color and then use XGetImage() to read 
  646. back that pixel.  However, this action alters the contents of the window, and 
  647. it suffers from race conditions with exposures. [courtesy Dave Lemke of NCD 
  648. and Stuart Marks of Sun]
  649.  
  650.     Note that the same applies to the border pixel/pixmap. This is a 
  651. (mis)feature of the protocol which allows the server is free to manipulate the
  652. pixel/pixmap however it wants.  By not requiring the server to keep the 
  653. original pixel or pixmap, some (potentially a lot of) space can be saved. 
  654. [courtesy Jim Fulton, then of X Consortium]
  655.  
  656. ----------------------------------------------------------------------
  657. Subject: 148)  How do I create a transparent window?
  658.     
  659.     A completely transparent window is easy to get -- use an InputOnly
  660. window. In order to create a window which is *mostly* transparent, you have
  661. several choices:
  662.     - the SHAPE extension first released with X11R4 offers an easy way to
  663. make non-rectangular windows, so you can set the shape of the window to fit the
  664. areas where the window should be nontransparent; however, not all servers 
  665. support the extension.
  666.     - a machine-specific method of implementing transparent windows for
  667. particular servers is to use an overlay plane supported by the hardware.  Note 
  668. that there is no X notion of a "transparent color index".
  669.     - a generally portable solution is to use a large number of tiny 
  670. windows, but this makes operating on the application as a unit difficult.
  671.     - a final answer is to consider whether you really need a transparent
  672. window or if you would be satisfied with being able to overlay your application
  673. window with information; if so, you can draw into separate bitplanes in colors
  674. that will appear properly.
  675.  
  676. [thanks to der Mouse, mouse@lightning.McRCIM.McGill.EDU, 3/92; see also
  677. The X Journal 1:4 for a more complete answer, including code samples for this
  678. last option]
  679.  
  680. ----------------------------------------------------------------------
  681. Subject: 149)  Why doesn't GXxor produce mathematically-correct color values?
  682.  
  683.     When using GXxor you may expect that drawing with a value of black on a
  684. background of black, for example, should produce white. However, the drawing
  685. operation does not work on RGB values but on colormap indices. The color that
  686. the resulting colormap index actually points to is undefined and visually
  687. random unless you have actually filled it in yourself. [On many X servers Black
  688. and White often 0/1 or 1/0; programs taking advantage of this mathematical
  689. coincidence will break.]
  690.     If you want to be combining colors with GXxor, then you should be 
  691. allocating a number of your own color cells and filling them with your chosen
  692. pre-computed values.
  693.     If you want to use GXxor simply to switch between two colors, then you 
  694. can take the shortcut of setting the background color in the GC (graphics 
  695. context) to 0 and the foreground color to a value such that when it draws over 
  696. red, say, the result is blue, and when it draws over blue the result is red. 
  697. This foreground value is itself the XOR of the colormap indices of red and 
  698. blue.
  699.  
  700. [Thanks to Chris Flatters (cflatter@zia.aoc.nrao.EDU) and Ken Whaley 
  701. (whaley@spectre.pa.dec.com), 2/91]
  702.  
  703. ----------------------------------------------------------------------
  704. Subject: 150)  Why does every color I allocate show up as black?
  705.  
  706.     Make sure you're using 16 bits and not 8.  The red, green, and blue 
  707. fields of an XColor structure are scaled so that 0 is nothing and 65535 is 
  708. full-blast. If you forget to scale (using, for example, 0-255 for each color) 
  709. the XAllocColor function will perform correctly but the resulting color is 
  710. usually black. 
  711.  
  712. [Thanks to Paul Asente, asente@adobe.com, 7/91]
  713.  
  714. ----------------------------------------------------------------------
  715. Subject: 151)  Why do I get a protocol error when creating a cursor (sic)?
  716.  
  717.     You may have had this code working on a monochrome system by
  718. coincidence.  Cursor pixmaps must always have a depth of 1; when you create
  719. the cursor pixmap use the depth of 1 rather than the default depth of the
  720. screen.
  721.  
  722. ----------------------------------------------------------------------
  723. Subject: 152)  Why can't my program get a standard colormap?
  724. I have an image-processing program which uses XGetRGBColormap() to get the 
  725. standard colormap, but it doesn't work. 
  726.  
  727.     XGetRGBColormap() when used with the property XA_RGB_DEFAULT_MAP does 
  728. not create a standard colormap -- it just returns one if one already exists.
  729. Use xstdcmap or do what it does in order to create the standard colormap first.
  730.  
  731. [1/91; from der Mouse (mouse@larry.mcrcim.mcgill.edu)]
  732.  
  733. ----------------------------------------------------------------------
  734. Subject: 153)  Why does the pixmap I copy to the screen show up as garbage? 
  735.  
  736.     The initial contents of pixmaps are undefined.  This means that most
  737. servers will allocate the memory and leave around whatever happens to be there 
  738. -- which is usually garbage.  You probably want to clear the pixmap first using
  739. XFillRectangle() with a function of GXcopy and a foreground pixel of whatever 
  740. color you want as your background (or 0L if you are using the pixmap as a 
  741. mask). [courtesy Dave Lemke of NCD and Stuart Marks of Sun]
  742.  
  743. ----------------------------------------------------------------------
  744. Subject: 154)! How do I check whether a window ID is valid?
  745. My program has the ID of a window on a remote display. I want to check whether
  746. the window exists before doing anything with it.
  747.  
  748.     Because X is asynchronous, there isn't a guarantee that the window 
  749. would still exist between the time that you got the ID and the time you sent an
  750. event to the window or otherwise manipulated it. What you should do is send the
  751. event without checking, but install an error handler to catch any BadWindow
  752. errors, which would indicate that the window no longer exists. This scheme
  753. will work except on the [rare] occasion that the original window has been
  754. destroyed and its ID reallocated to another window. 
  755.     You can use this scheme to make a function which checks the validity
  756. of a window; you can make this operation almost synchronous by calling
  757. XSync() after the request, although there is still no guarantee that the
  758. window will exist after the result (unless the sterver is grabbed). On the 
  759. whole, catching the error rather than pre-checking is preferable.
  760.  
  761. [courtesy Ken Lee (klee@synoptics.com), 4/90; 12/93]
  762.  
  763. ----------------------------------------------------------------------
  764. Subject: 155)  Can I have two applications draw to the same window?
  765.  
  766.     Yes. The X server assigns IDs to windows and other resources (actually,
  767. the server assigns some bits, the client others), and any application that 
  768. knows the ID can manipulate the resource [almost any X server resource, except
  769. for GCs and private color cells, can be shared].
  770.     The problem you face is how to disseminate the window ID to multiple 
  771. applications. A simple way to handle this (and which solves the problem of the
  772. applications' running on different machines) is in the first application to 
  773. create a specially-named property on the root-window and put the window ID into
  774. it. The second application then retrieves the property, whose name it also
  775. knows, and then can draw whatever it wants into the window.
  776.     [Note: this scheme works iff there is only one instance of the first
  777. application running, and the scheme is subject to the limitations mentioned
  778. in the Question about using window IDs on remote displays.]
  779.     Note also that you will still need to coordinate any higher-level 
  780. cooperation among your applications. 
  781.     Note also that two processes can share a window but should not try to 
  782. use the same server connection. If one process is a child of the other, it 
  783. should close down the connection to the server and open its own connection.
  784.     Note also that Display IDs and GC values describe addresses local
  785. to an application and cannot be transmitted to another application.
  786.     Note also that several clients may draw to a window but for particular
  787. X events such as button-presses only one client can receive the event.
  788.  
  789. [mostly courtesy Phil Karlton (karlton@wpd.sgi.com) 6/90]
  790.  
  791. ----------------------------------------------------------------------
  792. Subject: 156)  Why can't my program work with tvtwm or swm?
  793.  
  794.     A number of applications, including xwd, xwininfo, and xsetroot, do not
  795. handle the virtual root window which tvtwm and swm use; they typically return 
  796. the wrong child of root. A general solution is to add this code or to use it in
  797. your own application where you would normally use RootWindow(dpy,screen):
  798.  
  799. /* Function Name: GetVRoot
  800.  * Description: Gets the root window, even if it's a virtual root
  801.  * Arguments: the display and the screen
  802.  * Returns: the root window for the client
  803.  */
  804. #include <X11/Xatom.h>
  805. Window GetVRoot(dpy, scr)
  806. Display        *dpy;
  807. int             scr;
  808. {
  809. Window          rootReturn, parentReturn, *children;
  810. unsigned int    numChildren;
  811. Window          root = RootWindow(dpy, scr);
  812. Atom            __SWM_VROOT = None;
  813. int             i;
  814.  
  815.   __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
  816.   XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren);
  817.   for (i = 0; i < numChildren; i++) {
  818.     Atom            actual_type;
  819.     int             actual_format;
  820.     long            nitems, bytesafter;
  821.     Window         *newRoot = NULL;
  822.  
  823.     if (XGetWindowProperty(dpy, children[i], __SWM_VROOT, 0, 1,
  824.         False, XA_WINDOW, &actual_type, &actual_format, &nitems,
  825.             &bytesafter, (unsigned char **) &newRoot) == Success && newRoot) {
  826.             root = *newRoot;
  827.             break;
  828.         }
  829.     }
  830.  
  831.     return root;
  832. }
  833.  
  834. [courtesy David Elliott (dce@smsc.sony.com). Similar code is in ssetroot, a
  835. version of xsetroot distributed with tvtwm. 2/91]
  836.  
  837. A header file by Andreas Stolcke of ICSI on ftp.x.org:contrib/vroot.h 
  838. functions similarly by providing macros for RootWindow and DefaultRootWindow;
  839. code can include this header file first to run properly in the presence of a
  840. virtual desktop.
  841.  
  842. (Note the possible race condition.)
  843.     
  844. ----------------------------------------------------------------------
  845. Subject: 157)  Can I rely on a server which offers backing store?  
  846.  
  847.     You can assume only that the X server has the capability of doing
  848. backing store and that it might do so and keep your application's visuals
  849. up-to-date without your program's involvement; however, the X server can run
  850. out of resources at any time, so you must be able to handle the exposure
  851. events yourself. You cannot rely on a server which offers backing store to
  852. maintain your windows' contents on your behalf.
  853.  
  854. ----------------------------------------------------------------------
  855. Subject: 158)  How do I catch the "close window" event to avoid "fatal IO error"?
  856.  
  857.     Several windows managers offer a function such as f.kill or f.delete
  858. which sends a message to the application that it should delete its window;
  859. this is usually interpreted as a shutdown message.
  860.     The application needs to catch the WM_DELETE_WINDOW client message.
  861. There is a good example in the xcalc sources in X11R5.
  862.     Motif-based applications should in addition set the resource
  863. XmNdeleteResponse on the top-level shell to XmDO_NOTHING, whether they are
  864. using the Motif window manager or not.
  865.     If the application doesn't handle this message the window manager may
  866. wind up calling XKillClient, which disconnects the client from the display and
  867. typically gives an Xlib error along the lines of "fatal IO error 32 (Broken 
  868. pipe)".
  869.  
  870. [Thanks to Kaleb Keithley, kaleb@x.org; 11/93]
  871.  
  872. ----------------------------------------------------------------------
  873. Subject: 159)  How do I keep a window from being resized by the user?
  874.  
  875.     Resizing the window is done through the window manager; window managers
  876. can pay attention to the size hints your application places on the window, but 
  877. there is no guarantee that the window manager will listen. You can try setting 
  878. the minimum and maximum size hints to your target size and hope for the best. 
  879.     Note that you may wish to reconsider your justification for this
  880. restriction.
  881.  
  882. ----------------------------------------------------------------------
  883. Subject: 160)  How do I keep a window in the foreground at all times?
  884.  
  885.     It's rather antisocial for an application to constantly raise itself
  886. [e.g. by tracking VisibilityNotify events] so that it isn't overlapped -- 
  887. imagine the conflict between two such programs running.  
  888.     The only sure way to have your window appear on the top of the stack
  889. is to make the window override-redirect; this means that you are temporarily
  890. assuming window-management duties while the window is up, so you want to do 
  891. this infrequently and then only for short periods of time (e.g. for popup 
  892. menus or other short parameter-setting windows).
  893.  
  894. [thanks to der Mouse (mouse@larry.mcrcim.mcgill.edu); 7/92]
  895.  
  896. ----------------------------------------------------------------------
  897. Subject: 161)  How do I make text and bitmaps blink in X?
  898.  
  899.     There is no easy way.  Unless you're willing to depend on some sort of
  900. extension (as yet non-existent), you have to arrange for the blinking yourself,
  901. either by redrawing the contents periodically or, if possible, by playing games
  902. with the colormap and changing the color of the contents.
  903.  
  904. [Thanks to mouse@larry.mcrcim.mcgill.edu (der Mouse), 7/91]
  905.  
  906. ----------------------------------------------------------------------
  907. Subject: 162)  How do I get a double-click in Xlib?
  908.  
  909.     Users of Xt have the support of the translation manager to help 
  910. get notification of double-clicking.
  911.     There is no good way to get only a double-click in Xlib, because the 
  912. protocol does not provide enough support to do double-clicks.  You have to do 
  913. client-side timeouts, unless the single-click action is such that you can defer
  914. actually taking it until you next see an event from the server.  Thus, you 
  915. have to do timeouts, which means system-dependent code.  On most UNIXish 
  916. implementations, you can use XConnectionNumber to get the file descriptor of 
  917. the X connection and then use select() or something similar on that.
  918.     Note that many user-interface references suggest that a double-click
  919. be used to extend the action indicated by a single-click; if this is the case
  920. in your interface then you can execute the first action and as a compromise
  921. check the timestamp on the second event to determine whether it, too, should
  922. be the single-click action or the double-click action.
  923.  
  924. [Thanks to mouse@larry.mcrcim.mcgill.edu (der Mouse), 4/93]
  925.  
  926. ----------------------------------------------------------------------
  927. Subject: 163)  How do I render rotated text?
  928.     
  929.     Xlib intentionally does not provide such sophisticated graphics 
  930. capabilities, leaving them up to server-extensions or clients-side graphics
  931. libraries.
  932.     Your only choice, if you want to stay within the core X protocol, is to
  933. render the text into a pixmap, read it back via XGetImage(), rotate it "by 
  934. hand" with whatever matrices you want, and put it back to the server via 
  935. XPutImage(); more specifically:
  936.     1) create a bitmap B and write your text to it.
  937.     2) create an XYBitmap image I from B (via XGetImage).
  938.     3) create an XYBitmap Image I2 big enough to handle the transformation.
  939.     4) for each x,y in I2, I2(x,y) = I(a,b) where 
  940.         a = x * cos(theta) - y * sin(theta)
  941.         b = x * sin(theta) + y * cos(theta)
  942.     5) render I2
  943.     Note that you should be careful how you implement this not to lose
  944. bits; an algorithm based on shear transformations may in fact be better.
  945.     The high-level server-extensions and graphics packages available for X 
  946. also permit rendering of rotated text: Display PostScript, PEX, PHiGS, and GKS,
  947. although most are not capable of arbitrary rotation and probably do not use the
  948. same fonts that would be found on a printer.
  949.     In addition, if you have enough access to the server to install a font
  950. on it, you can create a font which consists of letters rotated at some
  951. predefined angle. Your application can then itself figure out placement of each
  952. glyph.
  953.  
  954. [courtesy der Mouse (mouse@larry.mcrcim.mcgill.edu), Eric Taylor 
  955. (etaylor@wilkins.bmc.tmc.edu), and Ken Lee (klee@synoptics.com), 11/90;
  956. Liam Quin (lee@sq.com), 12/90]
  957.  
  958.     InterViews (C++ UI toolkit, in the X contrib software) has support for
  959. rendering rotated fonts in X.  It could be one source of example code.
  960. [Brian R. Smith (brsmith@cs.umn.edu), 3/91]
  961.     Another possibility is to use the Hershey Fonts; they are 
  962. stroke-rendered and can be used by X by converting them into XDrawLine 
  963. requests. [eric@pencom.com, 10/91]
  964.  
  965.     The xrotfont program by Alan Richardson (mppa3@syma.sussex.ac.uk) 
  966. (posted to comp.sources.x July 14 1992) paints a rotated font by implementing 
  967. the method above and by using an outline (Hershey) font.
  968.     The xvertext package by Alan Richardson (mppa3@syma.sussex.ac.uk) is a 
  969. set of functions to facilitate the writing of text at any angle.  It is on 
  970. ftp.x.org as contrib/xvertext.5.0.shar.Z. 
  971.  
  972.     O'Reilly's X Resource Volume 3 includes information from HP about
  973. modifications to the X fonts server which provide for rotated and scaled text.
  974.  
  975. ----------------------------------------------------------------------
  976. Subject: 164)  Why doesn't my multi-threaded X program work (sic) ? 
  977.  
  978. You cannot use non-thread aware, non-reentrant libraries with threads.
  979.  
  980. If you must do this, you have only one choice: call the functions from the
  981. initial thread only.
  982.  
  983. Why opening windows from other threads causes protocol errors can be
  984. explained easily: you are accessing shared resources (the display
  985. structure, the connection to the display, static data in the Xlib) from
  986. a number of threads at the same time, without using any form of
  987. exclusive access control.
  988.  
  989. [Thanks to casper@fwi.uva.nl (Casper H.S. Dik)]
  990.  
  991. ----------------------------------------------------------------------
  992. Subject: 165)  What is the X Registry? (How do I reserve names?)
  993.  
  994.     There are places in the X Toolkit, in applications, and in the X
  995. protocol that define and use string names. The context is such that conflicts
  996. are possible if different components use the same name for different things.
  997.     The X Consortium maintains a registry of names in these domains:
  998. orgainization names, selection names, selection targets, resource types,
  999. application classes, and class extension record types; and several others.
  1000.     The list as of 7/91 is in the directory mit/doc/Registry on the R5 
  1001. tape; it is also available by sending "send docs registry" to the xstuff mail
  1002. server.
  1003.     To register names (first come, first served) or to ask questions send 
  1004. to xregistry@x.org; be sure to include a postal address for confirmation.
  1005.  
  1006. [11/90; condensed from Asente/Swick Appendix H]
  1007. ----------------------------------------------------------------------
  1008.  
  1009.  
  1010. David B. Lewis                     faq%craft@uunet.uu.net
  1011.  
  1012.         "Just the FAQs, ma'am." -- Joe Friday 
  1013. -- 
  1014. David B. Lewis        Temporarily at but not speaking for Visual, Inc.
  1015. day: dbl@visual.com    evening: david%craft@uunet.uu.net
  1016.